<template>
  <!-- 重置密码dialog -->
  <el-dialog title="出入库记录" :visible.sync="visible" width="60%">
    <el-tabs v-model="queryParams.auditType" type="card" @tab-click="getList">
      <el-tab-pane label="入库" name="1"></el-tab-pane>
      <el-tab-pane label="出库" name="2"></el-tab-pane>
    </el-tabs>
    <el-form
      :model="queryParams"
      ref="queryForm"
      size="mini"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item
        label-width="100px"
        label="砼单创建时间"
        prop="startCreateTime"
      >
        <QuickFilterDate :disableArr="[1,2,3,4,5,6,7]" v-model="queryDateArr" />
      </el-form-item>
      <el-form-item label="供应商名称" prop="orderNo" label-width="120px">
        <el-input
          v-model.trim="queryParams.orderNo"
          placeholder="请输入供应商名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="mini"
          @click="handleQuery"
          >搜索</el-button
        >
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
          >重置</el-button
        >
      </el-form-item>
    </el-form>

    <el-table v-loading="loading" :data="teamList">
      <el-table-column label="订单编号" align="center" prop="orderNo" />
      <el-table-column label="砼单ID" align="center" prop="id" />
      <el-table-column label="部位名称" align="center" prop="partsName" />
      <el-table-column label="主标号" align="center" prop="primaryDesign" />
      <el-table-column
        width="200"
        label="主标号一级品类"
        align="center"
        prop="primaryFirstCategory"
      />
      <el-table-column label="生产方量" align="center" prop="productVolume" />
      <el-table-column label="运输方量" align="center" prop="transVolume" />
    </el-table>

    <pagination
      v-show="total > 0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <span slot="footer" class="dialog-footer">
      <el-button @click="handelCancel">取 消</el-button>
      <el-button type="primary" @click="handleSubmit">确 定</el-button>
    </span>
  </el-dialog>
</template>
  <script>
import { updateUser } from "@/api/system/user";
import QuickFilterDate from "@/components/QuickFilterDate";
import {
  delTeam,
  addTeam,
  updateTeam,
} from "@/api/service/production/scheduling";
import { replyConcrete } from "@/api/service/production/receiptManagement";
import {
  concreteList,
  getTimeLine,
} from "@/api/service/production/concreteStatistics";

export default {
  components: {
    QuickFilterDate,
  },
  data() {
    return {
      initObj: {},
      visible: false,
      changeForm: {
        kc: "",
      },
      rules: {
        kc: [
          {
            required: true,
            message: "请输入",
            trigger: "change",
          },
        ],
      },

      dialogVisible: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 排班管理表格数据
      teamList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 20,
        auditType:'1',
        startCreateTime: null,
        endCreateTime: null,
        orderNo: null,
        concreteId: null,
        engineeringName: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {},
    };
  },
  props: {},
  computed: {
    queryDateArr: {
      get() {
        if (this.queryParams?.startCreateTime) {
          return [
            this.queryParams?.startCreateTime,
            this.queryParams?.endCreateTime,
          ];
        }
        return [];
      },
      set(value) {
        this.queryParams.startCreateTime = value[0];
        this.queryParams.endCreateTime = value[1];
      },
    },
  },
  methods: {
    // 初始化函数--->父级调用
    handelInit(val) {
      console.log(val);
      this.initObj = val;
      this.visible = true;
      this.getList();
    },
    handelCancel() {
      this.$refs.changeForm.resetFields();
      this.visible = false;
    },
    handleSubmit() {
      
    },
    /** 查询排班管理列表 */
    getList() {
      this.loading = true;
      concreteList(this.queryParams).then((response) => {
        this.teamList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.startCreateTime = null;
      this.queryParams.endCreateTime = null;
      this.resetForm("queryForm");
      this.handleQuery();
    },
  },
};
</script>